using System;
using System.Drawing;

namespace Sharpmark.PerfectLife.ColorfulPhotos.Framework.Picture
{
	public class Photo
    {
		private Bitmap _rawPhoto;

		public Bitmap Bitmap
		{
			get { return _rawPhoto; }
		}

		public int Height
		{
			get { return _rawPhoto.Height; }
		}

		public int Width
		{
			get { return _rawPhoto.Width; }
		}

		private Photo()
		{
			_rawPhoto = new Bitmap(200, 200);
		}

		public Photo(Image original, int width, int height)
		{
			_rawPhoto = new Bitmap(original, width, height);
		}

		public Photo(Image original)
			: this(original, original.Width, original.Height)
		{
		}

		public Photo(Image original, Size newSize)
			: this(original, (newSize.Width != 0) ? newSize.Width : 0, (newSize.Height != 0) ? newSize.Height : 0)
		{
		}

		public Photo(int width, int height, System.Drawing.Imaging.PixelFormat format)
		{
			_rawPhoto = new Bitmap(width, height, format);
		}

		public Photo(int width, int height)
			: this(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
		{
		}

		public Photo(int width, int height, System.Drawing.Graphics g)
		{
			_rawPhoto = new Bitmap(width, height, g);
		}

		public Photo(string filename)
		{
			_rawPhoto = new Bitmap(filename);
		}

		public Photo GetThumbnailImage(int width, int height)
		{
			return new Photo(_rawPhoto.GetThumbnailImage(width, height, null, IntPtr.Zero));
		}

		public Color GetPixel(int x, int y)
		{
			return _rawPhoto.GetPixel(x, y);
		}
    }
}
